<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE HTML>
<html>
  <head>
    <title>注册审核</title>
    <%@ include file="/common/meta.jsp"%>
    <script type="text/javascript" src="${ctx}/js/jquery-1.7.2.min.js"></script>
  </head>
  
  <body>
  <table style="width:100%;" >
  	<thead>
  		<tr>
  			<th width="5%">编号</th><th width="7%">用户名</th>
  			<th width="7%">用户类型</th><th width="25%">用户简介</th>
  			<th width="15%">邮箱</th><th width="15%">申请日期</th>
  			<th width="10%">状态</th><th width="15%">操作</th>
  		</tr>
  	</thead>
  	<tbody>
  		<c:if test="${empty pageResults.contents}">
  			<tr><td colspan="8">没有未审核的注册申请！</td></tr>
  		</c:if>
  		<c:if test="${!empty pageResults.contents}">
  			<c:forEach items="${pageResults.contents}" var="list" varStatus="p">
	  			<tr align="center">
	  				<td width="5%">${p.count}</td>
	  				<td width="7%">${list.userName}</td>
	  				<td width="7%">
	  					<c:choose>
	  						<c:when test="${list.userType == 'COMMON_USER'}">用户</c:when>
	  						<c:when test="${list.userType == 'DOCTOR'}">医生</c:when>
	  					</c:choose>
	  				</td>
	  				<td width="25%">${list.introduction}</td>
	  				<td width="15%">${list.email}</td>
	  				<td width="15%">${list.registerDate}</td>
	  				<td width="10%">
	  					<c:choose>
	  						<c:when test="${list.status == 0}">待审核</c:when>
	  						<c:when test="${list.status == 1}">审核通过</c:when>
	  						<c:when test="${list.status == 2}">审核未通过</c:when>
	  					</c:choose>
	  				</td>
	  				<td width="15%">
	  				<c:choose>
	  					<c:when test="${list.status == 0}">
	  						<a href="javascript:void(0)" onclick="pass(${list.id},this)">通过</a>&nbsp;
			  				<a href="javascript:void(0)" onclick="notpass(${list.id},this)">不通过</a>
	  					</c:when>
	  					<c:otherwise>
	  						<a href="javascript:(0);">通过</a>&nbsp;
			  				<a href="javascript:(0);">不通过</a>
	  					</c:otherwise>
	  				</c:choose>
	  				</td>
	  			</tr>
	  		</c:forEach>
  		</c:if>
  	</tbody>
  </table>
  <jsp:include page="/common/page.jsp"/>
  <script type="text/javascript">
	  function pass(id,obj){
		  $.getJSON("pass-register.do",{id:id},function(json){
				alert(json);
				//删除掉已经操作过的，相当于刷新
				$(obj).parent().parent("tr").remove();
		  });
	  }
	  
	  function notpass(id,obj){
		  $.getJSON("not-pass-register.do",{id:id},function(json){
				alert(json);
				$(obj).parent().parent("tr").remove();
		  });
	  }
  </script>
  </body>
</html>